<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">核按钮</button>
    <script>
        var btn = document.querySelector('.btn')
        // createElement创建元素
        var div1 = document.createElement('div');
        div1.innerHTML = '我是由js创建出来的div';
        // 添加到文档中，从末尾添加
        // document.body.appendChild(div1)
        // insertBefore 插入到某个元素之前
        document.body.insertBefore(div1, btn);
    </script>
</body>
</html>